/************************************************************************

								Heroes IV
					  Copyright 2002, The 3DO Company

	------------------------------------------------------------------
  						      adv_artifact_pile.h

	$Header: $

	$NoKeywords: $

 ************************************************************************/

#ifndef ADV_ARTIFACT_PILE_H_INCLUDED
#define ADV_ARTIFACT_PILE_H_INCLUDED

#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000

#include "artifact.h"
#include "bool_array.h"
#include "stationary_adventure_object.h"

class t_player;
class t_adv_artifact_pile;
class t_creature_array;

typedef t_counted_ptr< t_adv_artifact_pile > t_adv_artifact_pile_ptr;

// ---------------------------------------------------------------------------
// An adventure object which contains the artifacts left over after a battle
// in which both sides lost or there was not, for whatever reason, anywhere
// to put the artifacts from the killed creatures
// NOT created in the map editor; only created during play
// ---------------------------------------------------------------------------
class t_adv_artifact_pile : public t_stationary_adventure_object
{
	public:
		t_adv_artifact_pile( std::string const&  model_name );
		t_adv_artifact_pile( bool is_ocean );

		virtual void		activate_trigger( t_army* army, t_adv_map_point const& point, 
										      t_direction direction, t_adventure_frame* frame );
		void				add_artifacts( t_artifact_list const & artifacts, t_player * player1, t_player * player2 );
		virtual bool		can_be_hidden() const;
		virtual int         get_version() const;
		virtual bool		is_deleted_by_deletion_marker() const;
		static bool			is_good_creation_point( t_adv_map_point point, t_adv_artifact_pile_ptr & pile, t_adventure_map * map );
		virtual bool		is_visible_to( int team_num ) const;
		static void			pull_artifacts_from_array( t_creature_array & array, t_player * visible_to_player );
		static bool			scan_for_good_creation_point( t_adventure_object const & object, t_creature_array const & sample_army, t_adv_map_point & point, t_adv_artifact_pile_ptr & pile );
		virtual bool        read( std::streambuf&						stream, 
								  t_qualified_adv_object_type const&	type,
								  int									version );
		virtual bool        write( std::streambuf& stream ) const;

	private:
		void				add_player( t_player * player );

		t_artifact_list		m_artifacts;
		t_bool_array		m_teams;
};

#endif // ADV_ARTIFACT_PILE_H_INCLUDED
